package cn.tedu._05mvcboot01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class BMIController {
    @RequestMapping("/bmi")
    @ResponseBody
    public String index(double height,double weight){
        double bmi=weight/(height*height);
        String bmia=null;
        if (bmi<18.5){
            bmia= "偏瘦";
        }else if (bmi>=18.5 && bmi<24){
            bmia= "正常";
        }else if (bmi>=24 && bmi<27){
            bmia= "微胖";
        }else if (bmi>=27){
            bmia= "该减肥了";
        }

        return bmia;

    }


}
